package com.beifu.manager.controller;

import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.beifu.manager.model.WashFeedback;
import com.beifu.manager.service.washfeedback.WashFeedBackService;
import com.mds.manager.utils.PageUtils;
import com.mds.manager.utils.ResponseHelp;

@Controller
@RequestMapping("/washfeedback")
public class WashFeedBackController {
	private Logger Log = Logger.getLogger(this.getClass());
	
	@Autowired
	private WashFeedBackService washFeedBackService;
	
	@RequestMapping("/getFeedBackIndex")
	public String getFeedBackIndex(){
		Log.info("++++进入洗涤单反馈列表页+++++");
		return "/washfeedback/washfeedindex";
	}
	
	@ResponseBody
	@RequestMapping(value="/list",produces=MediaType.APPLICATION_JSON_VALUE+";charset=utf-8")
	public String getWashFeedBackList(HttpServletRequest request){
		String page = request.getParameter("pageNumber");
		String parameter = request.getParameter("id");
		
		PageUtils Page = new PageUtils(page);
		Page = washFeedBackService.getWashFeedBackList(Page, parameter);
		return ResponseHelp.responseText(Page);
	}

	@RequestMapping("/getWashFeedDetail")
	public String getWashFeedDetail(HttpServletRequest request){
		String id = request.getParameter("id");
		
		WashFeedback washFeedback = washFeedBackService.getWashFeedDetail(id);
		request.setAttribute("washFeedback", washFeedback);
		return "/washfeedback/washfeeddetail";
	}
}
